package com.allqj.sfx.ddd.member.infrastructure.converter;

import com.allqj.sfx.ddd.member.domain.entity.flow.FlowInstance;
import com.allqj.sfx.ddd.member.infrastructure.dao.FlowInstanceDAO;
import com.allqj.sfx.ddd.member.infrastructure.po.FlowInstanceDO;
import com.allqj.sfx.infrastructure.converter.DataConverter;
import org.springframework.beans.BeanUtils;

/**
 * @author sjw
 * @className FlowInstanceConverter
 * @date 2022/7/21 9:30
 * @description: FlowInstance&FlowInstanceDO转换器
 */
public class FlowInstanceConverter implements DataConverter<FlowInstance, FlowInstanceDO, FlowInstanceDAO> {

    // 转换器实例
    public static FlowInstanceConverter INSTANCE = new FlowInstanceConverter();


    @Override
    public FlowInstance do2Entity(FlowInstanceDO flowInstanceDO) {
        if (flowInstanceDO == null) return null;
        FlowInstance flowInstance = new FlowInstance();
        BeanUtils.copyProperties(flowInstanceDO, flowInstance);
        return flowInstance;
    }

    @Override
    public FlowInstanceDO entity2Do(FlowInstance flowInstance) {
        if (flowInstance == null) return null;
        FlowInstanceDO flowInstanceDO = new FlowInstanceDO();
        BeanUtils.copyProperties(flowInstance, flowInstanceDO);
        return flowInstanceDO;
    }

    @Override
    public FlowInstanceDO entity2Do(FlowInstance flowInstance, FlowInstanceDAO flowInstanceDAO) {
        return null;
    }
}
